package com.varian.security.authorization;

import lombok.RequiredArgsConstructor;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;

import java.util.List;

/**
 * @author ben
 * @since 2024/6/23
 */
@RequiredArgsConstructor
public class VarianAuthorizeHttpRequestCustomizer {

    private final List<AuthorizeHttpRequestCustomizer> customizers;

    public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) {
        customizers.forEach(customizer -> customizer.customize(registry));
        registry.anyRequest().authenticated();
    }
}
